home *** CD-ROM | disk | FTP | other *** search
/ Spidla DivX / DivX.bin / CatDV Pro 3.0.8 / lib / parser.jar / org / xml / sax / helpers / AttributeListImpl.class (.txt) next >
Encoding:
Java Class File  |  2000-02-23  |  1.9 KB  |  86 lines

  1. package org.xml.sax.helpers;
  2.  
  3. import java.util.Vector;
  4. import org.xml.sax.AttributeList;
  5.  
  6. public class AttributeListImpl implements AttributeList {
  7.    Vector names = new Vector();
  8.    Vector types = new Vector();
  9.    Vector values = new Vector();
  10.  
  11.    public AttributeListImpl() {
  12.    }
  13.  
  14.    public AttributeListImpl(AttributeList var1) {
  15.       this.setAttributeList(var1);
  16.    }
  17.  
  18.    public void addAttribute(String var1, String var2, String var3) {
  19.       this.names.addElement(var1);
  20.       this.types.addElement(var2);
  21.       this.values.addElement(var3);
  22.    }
  23.  
  24.    public void clear() {
  25.       this.names.removeAllElements();
  26.       this.types.removeAllElements();
  27.       this.values.removeAllElements();
  28.    }
  29.  
  30.    public int getLength() {
  31.       return this.names.size();
  32.    }
  33.  
  34.    public String getName(int var1) {
  35.       try {
  36.          return var1 < 0 ? null : (String)this.names.elementAt(var1);
  37.       } catch (ArrayIndexOutOfBoundsException var2) {
  38.          return null;
  39.       }
  40.    }
  41.  
  42.    public String getType(int var1) {
  43.       try {
  44.          return var1 < 0 ? null : (String)this.types.elementAt(var1);
  45.       } catch (ArrayIndexOutOfBoundsException var2) {
  46.          return null;
  47.       }
  48.    }
  49.  
  50.    public String getType(String var1) {
  51.       return this.getType(this.names.indexOf(var1));
  52.    }
  53.  
  54.    public String getValue(int var1) {
  55.       try {
  56.          return var1 < 0 ? null : (String)this.values.elementAt(var1);
  57.       } catch (ArrayIndexOutOfBoundsException var2) {
  58.          return null;
  59.       }
  60.    }
  61.  
  62.    public String getValue(String var1) {
  63.       return this.getValue(this.names.indexOf(var1));
  64.    }
  65.  
  66.    public void removeAttribute(String var1) {
  67.       int var2 = this.names.indexOf(var1);
  68.       if (var2 >= 0) {
  69.          this.names.removeElementAt(var2);
  70.          this.types.removeElementAt(var2);
  71.          this.values.removeElementAt(var2);
  72.       }
  73.  
  74.    }
  75.  
  76.    public void setAttributeList(AttributeList var1) {
  77.       int var2 = var1.getLength();
  78.       this.clear();
  79.  
  80.       for(int var3 = 0; var3 < var2; ++var3) {
  81.          this.addAttribute(var1.getName(var3), var1.getType(var3), var1.getValue(var3));
  82.       }
  83.  
  84.    }
  85. }
  86.